package com.zjj.day2.test5;
/**
 * @author zhoujunjie
 * @desc TODO
 * @date 2025/4/18
 */
class Monster {
    private String name;
    private int level;
    private int blood;
    private int power;
    private int defence;
    private String kind;

    public Monster(String name, int level, int blood, int power, int defence, String kind) {
        this.name = name;
        this.level = level;
        this.blood = blood;
        this.power = power;
        this.defence = defence;
        this.kind = kind;
    }

    public void attack(Hero h) {
        int damage = power - h.getDefence();
        if (damage > 0) {
            h.setBlood(h.getBlood() - damage);
            System.out.println(name + " 攻击了 " + h.getName() + "，造成了 " + damage + " 点伤害。");
        } else {
            System.out.println(name + " 攻击了 " + h.getName() + "，但未造成伤害。");
        }
    }

    public boolean isDead() {
        return blood <= 0;
    }

    public void show() {
        System.out.println("怪兽信息：");
        System.out.println("名称：" + name);
        System.out.println("等级：" + level);
        System.out.println("血量：" + blood);
        System.out.println("攻击力：" + power);
        System.out.println("防御力：" + defence);
        System.out.println("种族：" + kind);
    }

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    public int getDefence() {
        return defence;
    }

    public String getName() {
        return name;
    }
}